package com.ocean.web.controller.index;

import com.ocean.common.core.domain.AjaxResult;
import com.ocean.inxex.service.ProblemService;
import com.ocean.inxex.vo.ProblemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.parsing.Problem;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 *常见问题
 */
@Controller
@RequestMapping("/home")
public class ProblemController {
    @Autowired
    private ProblemService problemService;

    private String prefix = "index";

    @GetMapping("/problem")
    public String index()
    {
        return prefix + "/problem/problem";
    }

    @PostMapping("/getproblemlist")
    @ResponseBody
    public AjaxResult getproblemlist(ProblemVo vo)
    {
        List<ProblemVo> problem = problemService.getlist(vo.getAnswer());
        return AjaxResult.success(problem);
    }
}
